home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / cuj1008.zip / 1008012B < prev    next >
Text File  |  1992-06-12  |  339b  |  19 lines

  1.  
  2. Listing 2 -- atexit.c
  3.  
  4. /* atexit function */
  5. #include <stdlib.h>
  6.  
  7.         /* external declarations */
  8. extern void (*_Atfuns[])(void);
  9. extern size_t _Atcount;
  10.  
  11. int (atexit)(void (*func)(void))
  12.     {    /* function to call at exit */
  13.     if (_Atcount == 0)
  14.         return (-1);    /* list is full */
  15.     _Atfuns[--_Atcount] = func;
  16.     return (0);
  17.     }
  18.  
  19.